package dialogs;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.newxlmedical.R;

import beans.UserManageBean;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import custom.MyDialog;

/**
 * Created by Administrator on 2018/5/17.
 */

public class UserManageRegisterInfoDialog extends MyDialog {
    @BindView(R.id.tv_dialog_user_manage_info_number)
    TextView tvNumber;
    @BindView(R.id.tv_dialog_user_manage_info_name)
    TextView tvName;
    @BindView(R.id.tv_dialog_user_manage_info_role)
    TextView tvRole;
    @BindView(R.id.tv_dialog_user_manage_info_sure)
    TextView tvSure;
    @BindView(R.id.iv_dialog_user_manage_info_close)
    ImageView ivClose;
    private UserManageBean bean;
    public OnClickListener listener;

    public UserManageRegisterInfoDialog(@NonNull Context context, @StyleRes int themeResId, UserManageBean bean, OnClickListener listener) {
        super(context, themeResId);
        this.bean = bean;
        this.listener = listener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_user_manage_register_info);
        ButterKnife.bind(this);

        tvNumber.setText(bean.getNumber());
        tvName.setText(bean.getName());
        tvRole.setText(bean.getRole());
    }

    @OnClick({R.id.tv_dialog_user_manage_info_sure, R.id.iv_dialog_user_manage_info_close})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_dialog_user_manage_info_sure:
                listener.onSure(this);
                break;
            case R.id.iv_dialog_user_manage_info_close:
                dismiss();
                break;
        }
    }

    public interface OnClickListener {
        void onSure(UserManageRegisterInfoDialog dialog);
    }
}
